<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
  <title>角色菜单管理</title>
  <link href="${ctx}/static/support/icheck-1.0.2/skins/minimal/minimal.css" rel="stylesheet">
</head>
<body>
<div class="container-fluid">
  <!-- 路径导航 -->
  <ol class="breadcrumb">
    <li><a href="${ctx}/workbench">主页</a></li>
    <li><a href="${ctx}/role">角色管理</a></li>
    <li class="active">
      角色菜单配置
    </li>
  </ol>
  <!-- /路径导航 -->

  <div class="panel panel-default">
    <div class="panel-heading">
      <h3 class="panel-title">
        角色菜单配置
      </h3>
    </div>

    <div class="panel-body">
      <form class="form-horizontal" id="role-sidebar-form" action="${ctx}/role/sidebar" method="post" role="form">
        <input type="hidden" name="id" value="${role.id}"/>

        <c:forEach items="${topSidebar }" var="top">

          <div class="form-group">
            <div class="col-sm-2 text-right">
              <label class="checkbox-inline" style="padding-left: 0px;">
                <input type="checkbox" name="sidebars.id" value="${top.id}" <c:if test="${isExist[top.id] }">checked="checked"</c:if>>
                <span style="margin-left: 0px; vertical-align: middle;">${top.name}</span>
              </label>
            </div>
          </div>

          <c:if test="${not empty top.sidebars }">
            <div class="form-group">
              <div class="col-sm-offset-2 col-sm-10">
                <c:forEach items="${top.sidebars}" var="child">
                  <label class="checkbox-inline text-right" style="padding-left: 0px;">
                    <input type="checkbox" name="sidebars.id" value="${child.id}" <c:if test="${isExist[child.id] }">checked="checked"</c:if>>
                    <span style="margin-left: 0px; vertical-align: middle;">${child.name}</span>
                  </label>
                </c:forEach>
              </div>
            </div>
          </c:if>

        </c:forEach>

        <div class="form-group">
          <div class="col-sm-offset-2 col-sm-10">
            <button type="submit" class="btn btn-default" onclick="return confirm('是否提交上面的信息？')"> 提 交</button>
            <button type="button" class="btn btn-default" onclick="history.back()"> 返 回</button>
          </div>
        </div>
      </form>
    </div>

  </div>

</div>

<!-- 以下开始 加载JS动态效果 -->

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="${ctx}/static/jquery/jquery-1.11.3.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="${ctx}/static/bootstrap-3.3.5-dist/js/bootstrap.min.js"></script>


<!-- 增强复选框和单选框 -->
<script src="${ctx}/static/support/icheck-1.0.2/icheck.min.js"></script>

<script type="text/javascript">
  jQuery(document).ready(function () {
    $(':checkbox').iCheck({
      checkboxClass: 'icheckbox_minimal'
    });
  });
</script>
</body>
</html>